package com.lintf.distributed.transaction.inventory.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.lintf.distributed.transaction.inventory.entity.DeadLetterMessage;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ author lintf
 * @ system Mac
 * @ data 2025/6/26
 * @ package_name com.lintf.distributed.transaction.inventory.service
 * @ project_name distributed-transaction-demo
 * @ desc
 */
public interface DeadLetterService extends IService<DeadLetterMessage> {

    /**
     * 保存死信消息
     *
     * @param key         消息键
     * @param value       消息内容
     * @param topic       原始主题
     * @param cause       异常原因
     * @param retryCount  重试次数
     * @return 保存的死信消息实体
     */
    DeadLetterMessage saveDeadLetter(String key, String value, String topic, Throwable cause, Integer retryCount);

    /**
     * 重试死信消息
     *
     * @param deadLetterId 死信消息ID
     */
    void retryMessage(Long deadLetterId);
}
